// This file is part of the RECODER library and protected by the LGPL

package recodercs.io;

import java.io.*;

import recodercs.ServiceConfiguration;
import recodercs.io.ProjectSettings;
import recodercs.io.SourceFileRepository;
import recodercs.*;
import recodercs.util.*;

/**
   Facility to import and export project settings in various project files.
   @since 0.63
 */
public abstract class ProjectFileIO {

    private ServiceConfiguration config;

    public ProjectFileIO(ServiceConfiguration system) {
	config = system;
    }

    protected ServiceConfiguration getServiceConfiguration() {
	return config;
    }

    protected SourceFileRepository getSourceFileRepository() {
	return config.getSourceFileRepository();
    }

    protected ProjectSettings getProjectSettings() {
	return config.getProjectSettings();
    }
    
    /**
       Loads properties from the project file and returns the
       file names of the compilation units stored in the project file.
       It is left to subclasses to locate the project file.
       @return the filenames of the known compilation units.
     */
    public abstract String[] load() throws IOException;

    /**
       Saves the project properties to the project file and adds all
       known compilation units. This method does not write back the
       compilation units themselves.
       It is left to subclasses to locate the project file.
     */
    public abstract void save() throws IOException;    
}





